﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;

namespace LinqToBing.Bing.Wrapper.ExtensionMethods
{
    public static class AppIdChecker
    {
        /// <summary>
        /// Verify if string passed could represent a valid AppId.
        /// </summary>
        /// <param name="value">String to verify.</param>
        /// <returns>Returns true only if string passed could represent a valid AppId.</returns>
        public static bool IsValidAppId(this string value)
        {
            // a valid AppId contains 40 characters from 0 to 9 and from A to Z uppercase
            string pattern = @"^[0-9A-Z]{40}$";
            bool Result = !string.IsNullOrEmpty(value) && Regex.IsMatch(value, pattern);
            return Result;
        }
    }
}
